import pymysql
conn = pymysql.connect(
    host='localhost',
    user='root',
    passwd='123456',
    db='myemployees',
    port=3306,
    charset='utf8'
)
cur = conn.cursor()

# w = "select last_name,job_id,salary as sal from employees"
# w = "select * from employees"
# w = "select employee_id , last_name,salary * 12 'ANNUAL SALARY' from employees"
# w = "desc departments"
# w = "select distinct job_id from employees"
# w = "select last_name,salary from employees where salary>12000"
# w = "select last_name,department_id,salary*12 from employees where employee_id=176"
# w = "select last_name,salary from employees where salary not between 5000 and 12000"
# w = "select last_name,department_id from employees where department_id in(20,50)"
# w = "select last_name,job_id from employees where commission_pct is null "
# w = "select last_name,grade_level from employees f join job_grades e on f.salary between e.lowest_sal and e.highest_sal"
# w = "select last_name,department_id,salary*12 a from employees order by a desc,last_name asc"
# w = "select email,last_name from employees where email like '%e%' order by length(email) desc , department_id asc "
# w = "select last_name,salary from employees where salary between 8000 and 17000 order by salary asc"
# w = "select max(salary),min(salary),avg(salary),sum(salary) from employees order by job_id asc "
# w = "select MIN(salary) a,manager_id from employees where manager_id is not null group by manager_id having a >= 6000"
# w = "select count(*),avg(salary),department_id a from employees group by department_id order by a desc "
# w = "select b.boyname,a.name from beauty a inner join boys b on a.boyfriend_id = b.id where a.id>3"
# w = "select department_id from employees where last_name = 'Zlotkey'"
# w = "select last_name,salary,department_id from employees where department_id=(select department_id from employees where last_name = 'Zlotkey')"
# w = "select avg(salary) from employees"
# w = "select last_name,salary from employees where salary>(select avg(salary) from employees)"

cur.execute(w)
ret = cur.fetchall()
print(ret)











cur.close()
conn.close()

